<template>
  <div id="headTitle">
    <div class="yh-layout-box">
      <div class="title-left">
        <span class="title-logo" @click="routeToPath('/')">
          <img class="yh-middle" src="@/assets/images/meal/logo.png">
        </span>
        <span class="title-name">
          {{ title }}
        </span>
      </div>
      <div class="title-text" v-if="switchLogin == 'login' && getUserInfo()">
        <span class="yh-text-color cursor" @click="loginOut">退出登录</span>
      </div>
      <div class="title-text" v-else-if="switchLogin == 'login' && !getUserInfo()">
        已有账号？<span class="yh-text-color cursor" @click="routeToPath('/login')">马上登录</span>
      </div>
      <div class="title-text" v-else>
        <span class="yh-text-color cursor" @click="routeToPath('/login/register')">立即注册</span>
      </div>
    </div>
  </div>

</template>

<script>
export default {
  props: ['title', 'switchLogin'],
  created() {

  },
  methods: {

  }
}
</script>

<style lang="scss" scoped>
#headTitle{
  overflow: hidden;
  background-color: #FFF;
  padding-top: 16px;
  padding-bottom: 19px;
  font-size: 12px;
  .title-left{
    float: left;
    .title-name{
      color: #333333;
      font-size: 18px;
      margin-left: 42px;
    }
  }
  .title-text{
    float: right;
    font-size: 14px;
    line-height: 40px;
    color: #333333;
  }
}
</style>
